package com.workmanager.service;

import com.workmanager.bean.StudentBean;
import com.workmanager.mapper.MessageStudentMapper;
import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.List;

/**
 * ----------cherry------------
 * Created by Administrator on 2016/9/4 0004.
 */
@Service("infostudentService")
public class StudentMessageService {

    private MessageStudentMapper infoMapper;

    /** this is by cherry
     * 根据班级的id得到班级的名称
     * @param classid
     * @return
     */
    public String getClassNamebyId(int classid){
        return infoMapper.getClassNamebyId(classid);//可能是失去了Session注入的问题
    }

    /**
     * 根据班级名称得到班级的id
     * @param classname
     * @return
     */
    public String getidfromclassname(String classname){
        return infoMapper.getidfromclassname(classname);
    }

    /**
     * 判断是否已经修改好
     * @param studentBean
     * @return
     */
    public boolean updateresult(StudentBean studentBean){
        int result=infoMapper.studentMessagechange(studentBean);
        return result>=0;

    }

    /**
     * 得到所有的班级的名称
     * @return
     */
    public List<String> getallclassname(){
        List<String> classnames=infoMapper.getallclassname();
        return classnames;
    }

    /**
     * 根据学生ID得到学生的信息
     * @param studentid
     * @return
     */
    public StudentBean getstudentmessage(int studentid){
        return infoMapper.getstudentmessage(studentid);
    }


    public MessageStudentMapper getInfoMapper() {
        return infoMapper;
    }

    public void setInfoMapper(MessageStudentMapper infoMapper) {
        this.infoMapper = infoMapper;
    }
}
